-module(templel_parse).
-export([parse/1, parse_and_scan/1, format_error/1]).
-file("templel.yrl", 48).
%to_string(Expr) when is_atom(Expr) ->
%	atom_to_list(Expr);
%to_string(Expr) when is_integer(Expr) ->
%	integer_to_list(Expr);
%to_string(Expr) ->
%	Expr.

value_of(Token) ->
	element(3, Token).
%line_of(Token) ->
%	element(2, Token).

negate(B) when is_boolean(B) ->
	not(B);
negate(Expr) ->
	erlang:error({badarg, [Expr]}).

equal(true, true) -> true;
equal(false, false) -> true;
%
equal(I1, I2)
  when is_integer(I1), is_integer(I2) ->
  	if
		I1 =:= I2 -> true;
		true -> false
	end;
%
equal([C1|Cs1], [C2|Cs2]) when C1 =:= C2 ->
    equal(Cs1, Cs2);
equal([], []) -> true;
%
equal(_Expr1, _Expr2) -> false.

not_equal(Expr1, Expr2) ->
	not( equal(Expr1, Expr2) ).

lt(I1, I2)
  when is_integer(I1), is_integer(I2) ->
	I1 < I2;
lt(Expr1, Expr2) ->
	erlang:error({badarg, [Expr1,Expr2]}).

lt_eq(I1, I2)
  when is_integer(I1), is_integer(I2) ->
	I1 =< I2;
lt_eq(Expr1, Expr2) ->
	erlang:error({badarg, [Expr1,Expr2]}).

gt(I1, I2)
  when is_integer(I1), is_integer(I2) ->
	I1 > I2;
gt(Expr1, Expr2) ->
	erlang:error({badarg, [Expr1,Expr2]}).

gt_eq(I1, I2)
  when is_integer(I1), is_integer(I2) ->
	I1 >= I2;
gt_eq(Expr1, Expr2) ->
	erlang:error({badarg, [Expr1,Expr2]}).

land(B1, B2)
  when is_boolean(B1), is_boolean(B2) ->
  	if
		B1, B2 -> true;
		true -> false
	end;
land(Expr1, Expr2) ->
	erlang:error({badarg, [Expr1,Expr2]}).

lor(B1, B2)
  when is_boolean(B1), is_boolean(B2) ->
  	if
		B1; B2 -> true;
		true -> false
	end;
lor(Expr1, Expr2) ->
	erlang:error({badarg, [Expr1,Expr2]}).

-file("/opt/local/lib/erlang/lib/parsetools-1.4.2/include/yeccpre.hrl", 0).
%% ``The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved via the world wide web at http://www.erlang.org/.
%% 
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%% 
%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
%% AB. All Rights Reserved.''
%% 
%%     $Id $
%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The parser generator will insert appropriate declarations before this line.%

parse(Tokens) ->
    yeccpars0(Tokens, false).

parse_and_scan({F, A}) -> % Fun or {M, F}
    yeccpars0([], {F, A});
parse_and_scan({M, F, A}) ->
    yeccpars0([], {{M, F}, A}).

format_error(Message) ->
    case io_lib:deep_char_list(Message) of
	true ->
	    Message;
	_ ->
	    io_lib:write(Message)
    end.

% To be used in grammar files to throw an error message to the parser
% toplevel. Doesn't have to be exported!
-compile({nowarn_unused_function,{return_error,2}}).
-spec(return_error/2 :: (integer(), any()) -> no_return()).
return_error(Line, Message) ->
    throw({error, {Line, ?MODULE, Message}}).

-define(CODE_VERSION, "1.2").

yeccpars0(Tokens, MFA) ->
    try yeccpars1(Tokens, MFA, 0, [], [])
    catch 
        error: Error ->
            Stacktrace = erlang:get_stacktrace(),
            try yecc_error_type(Error, Stacktrace) of
                {syntax_error, Token} ->
                    yeccerror(Token);
                {missing_in_goto_table=Tag, State} ->
                    Desc = {State, Tag},
                    erlang:raise(error, {yecc_bug, ?CODE_VERSION, Desc},
                                Stacktrace);
                {missing_in_goto_table=Tag, Symbol, State} ->
                    Desc = {Symbol, State, Tag},
                    erlang:raise(error, {yecc_bug, ?CODE_VERSION, Desc},
                                Stacktrace)
            catch _:_ -> erlang:raise(error, Error, Stacktrace)
            end;
        throw: {error, {_Line, ?MODULE, _M}} = Error -> 
            Error % probably from return_error/2
    end.

yecc_error_type(function_clause, [{?MODULE,F,[_,_,_,_,Token,_,_]} | _]) ->
    "yeccpars2" ++ _ = atom_to_list(F),
    {syntax_error, Token};
yecc_error_type({case_clause,{State}}, [{?MODULE,yeccpars2,_}|_]) ->
    %% Inlined goto-function
    {missing_in_goto_table, State};
yecc_error_type(function_clause, [{?MODULE,F,[State]}|_]) ->
    "yeccgoto_" ++ SymbolL = atom_to_list(F),
    {ok,[{atom,_,Symbol}]} = erl_scan:string(SymbolL),
    {missing_in_goto_table, Symbol, State}.

yeccpars1([Token | Tokens], Tokenizer, State, States, Vstack) ->
    yeccpars2(State, element(1, Token), States, Vstack, Token, Tokens, 
              Tokenizer);
yeccpars1([], {F, A}, State, States, Vstack) ->
    case apply(F, A) of
        {ok, Tokens, _Endline} ->
	    yeccpars1(Tokens, {F, A}, State, States, Vstack);
        {eof, _Endline} ->
            yeccpars1([], false, State, States, Vstack);
        {error, Descriptor, _Endline} ->
            {error, Descriptor}
    end;
yeccpars1([], false, State, States, Vstack) ->
    yeccpars2(State, '$end', States, Vstack, {'$end', 999999}, [], false).

%% yeccpars1/7 is called from generated code.
%%
%% When using the {includefile, Includefile} option, make sure that
%% yeccpars1/7 can be found by parsing the file without following
%% include directives. yecc will otherwise assume that an old
%% yeccpre.hrl is included (one which defines yeccpars1/5).
yeccpars1(State1, State, States, Vstack, Stack1, [Token | Tokens], 
          Tokenizer) ->
    yeccpars2(State, element(1, Token), [State1 | States],
              [Stack1 | Vstack], Token, Tokens, Tokenizer);
yeccpars1(State1, State, States, Vstack, Stack1, [], {F, A}) ->
    case apply(F, A) of
        {ok, Tokens, _Endline} ->
	    yeccpars1(State1, State, States, Vstack, Stack1, Tokens, {F, A});
        {eof, _Endline} ->
            yeccpars1(State1, State, States, Vstack, Stack1, [], false);
        {error, Descriptor, _Endline} ->
            {error, Descriptor}
    end;
yeccpars1(State1, State, States, Vstack, Stack1, [], false) ->
    yeccpars2(State, '$end', [State1 | States], [Stack1 | Vstack],
              {'$end', 999999}, [], false).

% For internal use only.
yeccerror(Token) ->
    {error,
     {element(2, Token), ?MODULE,
      ["syntax error before: ", yecctoken2string(Token)]}}.

yecctoken2string({atom, _, A}) -> io_lib:write(A);
yecctoken2string({integer,_,N}) -> io_lib:write(N);
yecctoken2string({float,_,F}) -> io_lib:write(F);
yecctoken2string({char,_,C}) -> io_lib:write_char(C);
yecctoken2string({var,_,V}) -> io_lib:format('~s', [V]);
yecctoken2string({string,_,S}) -> io_lib:write_string(S);
yecctoken2string({reserved_symbol, _, A}) -> io_lib:format('~w', [A]);
yecctoken2string({_Cat, _, Val}) -> io_lib:format('~w', [Val]);
yecctoken2string({'dot', _}) -> io_lib:format('~w', ['.']);
yecctoken2string({'$end', _}) ->
    [];
yecctoken2string({Other, _}) when is_atom(Other) ->
    io_lib:format('~w', [Other]);
yecctoken2string(Other) ->
    io_lib:write(Other).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



-file("templel_parse.erl", 226).

yeccpars2(0=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(1=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_1(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(2=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_2(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(3=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_3(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(4=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_4(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(5=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_5(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(6=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_6(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(7=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(8=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(9=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_9(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(10=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_10(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(11=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_11(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(12=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_12(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(13=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_13(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(14=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_14(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(15=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_15(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(16=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_16(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(17=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_17(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(18=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_18(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(19=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_19(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(20=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_20(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(21=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(22=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_22(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(23=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_23(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(24=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_24(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(25=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_25(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(26=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(27=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_27(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(28=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(29=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(30=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(31=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(32=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(33=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(34=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_34(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(35=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_35(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(36=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_36(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(37=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_37(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(38=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_38(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(39=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_39(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(40=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(41=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_41(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(42=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_42(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(43=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_43(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(44=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_44(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(45=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_0(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(46=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_46(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(47=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_47(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(48=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_48(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(49=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_42(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(50=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_50(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(51=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_51(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(52=S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2_52(S, Cat, Ss, Stack, T, Ts, Tzr);
yeccpars2(Other, _, _, _, _, _, _) ->
 erlang:error({yecc_bug,"1.2",{missing_state_in_action_table, Other}}).

yeccpars2_0(S, '!', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 7, Ss, Stack, T, Ts, Tzr);
yeccpars2_0(S, '(', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 8, Ss, Stack, T, Ts, Tzr);
yeccpars2_0(S, boolean, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 9, Ss, Stack, T, Ts, Tzr);
yeccpars2_0(S, integer, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 10, Ss, Stack, T, Ts, Tzr);
yeccpars2_0(S, name, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 11, Ss, Stack, T, Ts, Tzr);
yeccpars2_0(S, string, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 12, Ss, Stack, T, Ts, Tzr).

yeccpars2_1(S, '.', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 43, Ss, Stack, T, Ts, Tzr);
yeccpars2_1(S, ':', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 44, Ss, Stack, T, Ts, Tzr);
yeccpars2_1(S, '[', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 45, Ss, Stack, T, Ts, Tzr);
yeccpars2_1(S, name, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 46, Ss, Stack, T, Ts, Tzr);
yeccpars2_1(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2(yeccgoto_expr(hd(Ss)), Cat, Ss, Stack, T, Ts, Tzr).

yeccpars2_2(_S, '$end', _Ss, Stack,  _T, _Ts, _Tzr) ->
 {ok, hd(Stack)}.

yeccpars2_3(S, '||', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 40, Ss, Stack, T, Ts, Tzr);
yeccpars2_3(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2(yeccgoto_lor(hd(Ss)), Cat, Ss, Stack, T, Ts, Tzr).

yeccpars2_4(S, '!=', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 28, Ss, Stack, T, Ts, Tzr);
yeccpars2_4(S, '<', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 29, Ss, Stack, T, Ts, Tzr);
yeccpars2_4(S, '<=', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 30, Ss, Stack, T, Ts, Tzr);
yeccpars2_4(S, '==', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 31, Ss, Stack, T, Ts, Tzr);
yeccpars2_4(S, '>', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 32, Ss, Stack, T, Ts, Tzr);
yeccpars2_4(S, '>=', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 33, Ss, Stack, T, Ts, Tzr);
yeccpars2_4(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2('yeccgoto_\'cond\''(hd(Ss)), Cat, Ss, Stack, T, Ts, Tzr).

yeccpars2_5(S, '&&', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 26, Ss, Stack, T, Ts, Tzr);
yeccpars2_5(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2(yeccgoto_land(hd(Ss)), Cat, Ss, Stack, T, Ts, Tzr).

yeccpars2_6(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 yeccpars2(yeccgoto_expr(hd(Ss)), Cat, Ss, Stack, T, Ts, Tzr).

%% yeccpars2_7: see yeccpars2_0

%% yeccpars2_8: see yeccpars2_0

yeccpars2_9(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_9_(Stack),
 yeccpars2(yeccgoto_expr(hd(Ss)), Cat, Ss, NewStack, T, Ts, Tzr).

yeccpars2_10(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_10_(Stack),
 yeccpars2(yeccgoto_expr(hd(Ss)), Cat, Ss, NewStack, T, Ts, Tzr).

yeccpars2_11(S, ':', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 13, Ss, Stack, T, Ts, Tzr);
yeccpars2_11(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_11_(Stack),
 yeccpars2(yeccgoto_pass(hd(Ss)), Cat, Ss, NewStack, T, Ts, Tzr).

yeccpars2_12(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_12_(Stack),
 yeccpars2(yeccgoto_expr(hd(Ss)), Cat, Ss, NewStack, T, Ts, Tzr).

yeccpars2_13(S, name, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 14, Ss, Stack, T, Ts, Tzr).

yeccpars2_14(S, '(', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 16, Ss, Stack, T, Ts, Tzr).

yeccpars2_15(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_15_(Stack),
 Nss = lists:nthtail(3, Ss),
 yeccpars2(yeccgoto_call(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_16(S, '!', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 7, Ss, Stack, T, Ts, Tzr);
yeccpars2_16(S, '(', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 8, Ss, Stack, T, Ts, Tzr);
yeccpars2_16(S, ')', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 19, Ss, Stack, T, Ts, Tzr);
yeccpars2_16(S, boolean, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 9, Ss, Stack, T, Ts, Tzr);
yeccpars2_16(S, integer, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 10, Ss, Stack, T, Ts, Tzr);
yeccpars2_16(S, name, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 11, Ss, Stack, T, Ts, Tzr);
yeccpars2_16(S, string, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 12, Ss, Stack, T, Ts, Tzr).

yeccpars2_17(S, ',', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 21, Ss, Stack, T, Ts, Tzr);
yeccpars2_17(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_17_(Stack),
 yeccpars2(yeccgoto_exprs(hd(Ss)), Cat, Ss, NewStack, T, Ts, Tzr).

yeccpars2_18(S, ')', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 20, Ss, Stack, T, Ts, Tzr).

yeccpars2_19(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_19_(Stack),
 Nss = tl(Ss),
 yeccpars2(yeccgoto_args(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_20(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_20_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2(yeccgoto_args(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

%% yeccpars2_21: see yeccpars2_0

yeccpars2_22(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_22_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2(yeccgoto_exprs(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_23(S, ')', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 24, Ss, Stack, T, Ts, Tzr).

yeccpars2_24(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_24_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2(yeccgoto_expr(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_25(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_25_(Stack),
 Nss = tl(Ss),
 yeccpars2(yeccgoto_expr(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

%% yeccpars2_26: see yeccpars2_0

yeccpars2_27(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_27_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2(yeccgoto_land(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

%% yeccpars2_28: see yeccpars2_0

%% yeccpars2_29: see yeccpars2_0

%% yeccpars2_30: see yeccpars2_0

%% yeccpars2_31: see yeccpars2_0

%% yeccpars2_32: see yeccpars2_0

%% yeccpars2_33: see yeccpars2_0

yeccpars2_34(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_34_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2('yeccgoto_\'cond\''(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_35(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_35_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2('yeccgoto_\'cond\''(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_36(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_36_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2('yeccgoto_\'cond\''(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_37(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_37_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2('yeccgoto_\'cond\''(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_38(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_38_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2('yeccgoto_\'cond\''(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_39(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_39_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2('yeccgoto_\'cond\''(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

%% yeccpars2_40: see yeccpars2_0

yeccpars2_41(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_41_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2(yeccgoto_lor(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_42(S, '(', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 16, Ss, Stack, T, Ts, Tzr);
yeccpars2_42(S, '.', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 43, Ss, Stack, T, Ts, Tzr);
yeccpars2_42(S, '[', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 45, Ss, Stack, T, Ts, Tzr).

yeccpars2_43(S, name, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 51, Ss, Stack, T, Ts, Tzr).

yeccpars2_44(S, name, Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 46, Ss, Stack, T, Ts, Tzr).

%% yeccpars2_45: see yeccpars2_0

yeccpars2_46(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_46_(Stack),
 yeccpars2(yeccgoto_pass(hd(Ss)), Cat, Ss, NewStack, T, Ts, Tzr).

yeccpars2_47(S, ']', Ss, Stack, T, Ts, Tzr) ->
 yeccpars1(S, 48, Ss, Stack, T, Ts, Tzr).

yeccpars2_48(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_48_(Stack),
 Nss = lists:nthtail(3, Ss),
 yeccpars2(yeccgoto_pass(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

%% yeccpars2_49: see yeccpars2_42

yeccpars2_50(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_50_(Stack),
 Nss = lists:nthtail(3, Ss),
 yeccpars2(yeccgoto_call(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_51(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_51_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2(yeccgoto_pass(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccpars2_52(_S, Cat, Ss, Stack, T, Ts, Tzr) ->
 NewStack = yeccpars2_52_(Stack),
 Nss = lists:nthtail(2, Ss),
 yeccpars2(yeccgoto_call(hd(Nss)), Cat, Nss, NewStack, T, Ts, Tzr).

yeccgoto_args(14) -> 15;
yeccgoto_args(42) -> 52;
yeccgoto_args(49) -> 50.

yeccgoto_call(0) -> 6;
yeccgoto_call(7) -> 6;
yeccgoto_call(8) -> 6;
yeccgoto_call(16) -> 6;
yeccgoto_call(21) -> 6;
yeccgoto_call(26) -> 6;
yeccgoto_call(28) -> 6;
yeccgoto_call(29) -> 6;
yeccgoto_call(30) -> 6;
yeccgoto_call(31) -> 6;
yeccgoto_call(32) -> 6;
yeccgoto_call(33) -> 6;
yeccgoto_call(40) -> 6;
yeccgoto_call(45) -> 6.

'yeccgoto_\'cond\''(0) -> 5;
'yeccgoto_\'cond\''(8) -> 5;
'yeccgoto_\'cond\''(16) -> 5;
'yeccgoto_\'cond\''(21) -> 5;
'yeccgoto_\'cond\''(26) -> 5;
'yeccgoto_\'cond\''(28) -> 39;
'yeccgoto_\'cond\''(29) -> 38;
'yeccgoto_\'cond\''(30) -> 37;
'yeccgoto_\'cond\''(31) -> 36;
'yeccgoto_\'cond\''(32) -> 35;
'yeccgoto_\'cond\''(33) -> 34;
'yeccgoto_\'cond\''(40) -> 5.

yeccgoto_expr(0) -> 4;
yeccgoto_expr(7) -> 25;
yeccgoto_expr(8) -> 4;
yeccgoto_expr(16) -> 4;
yeccgoto_expr(21) -> 4;
yeccgoto_expr(26) -> 4;
yeccgoto_expr(28) -> 4;
yeccgoto_expr(29) -> 4;
yeccgoto_expr(30) -> 4;
yeccgoto_expr(31) -> 4;
yeccgoto_expr(32) -> 4;
yeccgoto_expr(33) -> 4;
yeccgoto_expr(40) -> 4;
yeccgoto_expr(45) -> 47.

yeccgoto_exprs(16) -> 18;
yeccgoto_exprs(21) -> 22.

yeccgoto_land(0) -> 3;
yeccgoto_land(8) -> 3;
yeccgoto_land(16) -> 3;
yeccgoto_land(21) -> 3;
yeccgoto_land(26) -> 27;
yeccgoto_land(40) -> 3.

yeccgoto_lor(0) -> 2;
yeccgoto_lor(8) -> 23;
yeccgoto_lor(16) -> 17;
yeccgoto_lor(21) -> 17;
yeccgoto_lor(40) -> 41.

yeccgoto_pass(0) -> 1;
yeccgoto_pass(1) -> 42;
yeccgoto_pass(7) -> 1;
yeccgoto_pass(8) -> 1;
yeccgoto_pass(16) -> 1;
yeccgoto_pass(21) -> 1;
yeccgoto_pass(26) -> 1;
yeccgoto_pass(28) -> 1;
yeccgoto_pass(29) -> 1;
yeccgoto_pass(30) -> 1;
yeccgoto_pass(31) -> 1;
yeccgoto_pass(32) -> 1;
yeccgoto_pass(33) -> 1;
yeccgoto_pass(40) -> 1;
yeccgoto_pass(44) -> 49;
yeccgoto_pass(45) -> 1.

-compile({inline,{yeccpars2_9_,1}}).
-file("templel.yrl", 23).
yeccpars2_9_([__1 | Stack]) ->
 [begin
   value_of ( __1 )
  end | Stack].

-compile({inline,{yeccpars2_10_,1}}).
-file("templel.yrl", 24).
yeccpars2_10_([__1 | Stack]) ->
 [begin
   value_of ( __1 )
  end | Stack].

-compile({inline,{yeccpars2_11_,1}}).
-file("templel.yrl", 31).
yeccpars2_11_([__1 | Stack]) ->
 [begin
   templel_context : get_by_key ( __1 )
  end | Stack].

-compile({inline,{yeccpars2_12_,1}}).
-file("templel.yrl", 25).
yeccpars2_12_([__1 | Stack]) ->
 [begin
   value_of ( __1 )
  end | Stack].

-compile({inline,{yeccpars2_15_,1}}).
-file("templel.yrl", 36).
yeccpars2_15_([__4,__3,__2,__1 | Stack]) ->
 [begin
   apply ( list_to_atom ( value_of ( __1 ) ) , list_to_atom ( value_of ( __3 ) ) , __4 )
  end | Stack].

-compile({inline,{yeccpars2_17_,1}}).
-file("templel.yrl", 7).
yeccpars2_17_([__1 | Stack]) ->
 [begin
   [ __1 ]
  end | Stack].

-compile({inline,{yeccpars2_19_,1}}).
-file("templel.yrl", 41).
yeccpars2_19_([__2,__1 | Stack]) ->
 [begin
   none
  end | Stack].

-compile({inline,{yeccpars2_20_,1}}).
-file("templel.yrl", 42).
yeccpars2_20_([__3,__2,__1 | Stack]) ->
 [begin
   __2
  end | Stack].

-compile({inline,{yeccpars2_22_,1}}).
-file("templel.yrl", 8).
yeccpars2_22_([__3,__2,__1 | Stack]) ->
 [begin
   [ __1 | __3 ]
  end | Stack].

-compile({inline,{yeccpars2_24_,1}}).
-file("templel.yrl", 29).
yeccpars2_24_([__3,__2,__1 | Stack]) ->
 [begin
   ( __2 )
  end | Stack].

-compile({inline,{yeccpars2_25_,1}}).
-file("templel.yrl", 28).
yeccpars2_25_([__2,__1 | Stack]) ->
 [begin
   negate ( __2 )
  end | Stack].

-compile({inline,{yeccpars2_27_,1}}).
-file("templel.yrl", 13).
yeccpars2_27_([__3,__2,__1 | Stack]) ->
 [begin
   land ( __1 , __3 )
  end | Stack].

-compile({inline,{yeccpars2_34_,1}}).
-file("templel.yrl", 21).
yeccpars2_34_([__3,__2,__1 | Stack]) ->
 [begin
   gt_eq ( __1 , __3 )
  end | Stack].

-compile({inline,{yeccpars2_35_,1}}).
-file("templel.yrl", 20).
yeccpars2_35_([__3,__2,__1 | Stack]) ->
 [begin
   gt ( __1 , __3 )
  end | Stack].

-compile({inline,{yeccpars2_36_,1}}).
-file("templel.yrl", 16).
yeccpars2_36_([__3,__2,__1 | Stack]) ->
 [begin
   equal ( __1 , __3 )
  end | Stack].

-compile({inline,{yeccpars2_37_,1}}).
-file("templel.yrl", 19).
yeccpars2_37_([__3,__2,__1 | Stack]) ->
 [begin
   lt_eq ( __1 , __3 )
  end | Stack].

-compile({inline,{yeccpars2_38_,1}}).
-file("templel.yrl", 18).
yeccpars2_38_([__3,__2,__1 | Stack]) ->
 [begin
   lt ( __1 , __3 )
  end | Stack].

-compile({inline,{yeccpars2_39_,1}}).
-file("templel.yrl", 17).
yeccpars2_39_([__3,__2,__1 | Stack]) ->
 [begin
   not_equal ( __1 , __3 )
  end | Stack].

-compile({inline,{yeccpars2_41_,1}}).
-file("templel.yrl", 11).
yeccpars2_41_([__3,__2,__1 | Stack]) ->
 [begin
   lor ( __1 , __3 )
  end | Stack].

-compile({inline,{yeccpars2_46_,1}}).
-file("templel.yrl", 31).
yeccpars2_46_([__1 | Stack]) ->
 [begin
   templel_context : get_by_key ( __1 )
  end | Stack].

-compile({inline,{yeccpars2_48_,1}}).
-file("templel.yrl", 34).
yeccpars2_48_([__4,__3,__2,__1 | Stack]) ->
 [begin
   lists : nth ( __3 , __1 )
  end | Stack].

-compile({inline,{yeccpars2_50_,1}}).
-file("templel.yrl", 37).
yeccpars2_50_([__4,__3,__2,__1 | Stack]) ->
 [begin
   apply ( __1 , __3 , __4 )
  end | Stack].

-compile({inline,{yeccpars2_51_,1}}).
-file("templel.yrl", 32).
yeccpars2_51_([__3,__2,__1 | Stack]) ->
 [begin
   templel_context : get_by_key ( __1 , __3 )
  end | Stack].

-compile({inline,{yeccpars2_52_,1}}).
-file("templel.yrl", 39).
yeccpars2_52_([__3,__2,__1 | Stack]) ->
 [begin
   apply ( __1 , __2 , __3 )
  end | Stack].


-file("templel.yrl", 126).
